Skip to content

Upgrade libuv to 1.53.0 via the rescript-lang/luv fork - #8883

Merged
cknitt merged 4 commits into
masterfrom
luv-libuv-1.53
Oct 18, 2026
Merged

cknitt merged 4 commits into
masterfrom
luv-libuv-1.53

Conversation

@cknitt

@cknitt cknitt commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Upgrades the libuv used by the OCaml rewatch from 1.48.0 to 1.53.0 by building Luv from the rescript-lang/luv fork (rescript-lang/luv#2).

  • rescript.opam (via rescript.opam.template) pins luv.0.5.14+rescript.1 to the fork by commit hash (2094c025, the merge commit of Upgrade libuv to 1.53.0 and test native watcher APIs luv#2) with pin-depends, so opam install . fetches it in CI, the devcontainer and local setups without extra steps. dune-project requires that version.
  • The .github/opam-repository overlay is removed: the fork already contains its ARM64 musl -mno-outline-atomics fix.
  • The fork keeps libuv as a git submodule, so the pin is a git URL rather than a GitHub archive (archives omit submodules); opam's git fetch initializes it. A future fork change becomes +rescript.2 with a new hash.
  • The fork's only API change (Luv.File.Statfs reserved fields now read as zero) doesn't affect us: rewatch only uses FS_event, Loop, Timer, Handle and Error in native_watcher.ml.

Existing dev switches get the pinned Luv with the usual opam install . --deps-only --with-test.

Performance is unchanged: watch latency, watcher startup, idle CPU and clean builds measured the same as with libuv 1.48 (Linux only; macOS and Windows weren't measured).

No new tests: there's no observable behavior change, and the existing watch tests in the shared rewatch suite cover the watcher.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9Q6perkzKBQQebDnVXAEK

cknitt and others added 2 commits October 17, 2026 07:40
The opam override for Luv now fetches commit 8c12b1a of rescript-lang/luv
(PR rescript-lang/luv#2) instead of patching the upstream 0.5.14 tarball.
The fork vendors libuv 1.53.0 instead of 1.48.0 and already carries the
ARM64 musl -mno-outline-atomics fix, so the local patch is gone. The
package is versioned 0.5.14+rescript.1 and dune-project/rescript.opam pin
that version.

Review: Why a git URL and not a release tarball? The fork keeps libuv as a
git submodule; GitHub archives omit submodules, while opam's git fetch
initializes them. The commit hash should move to the merge commit once
rescript-lang/luv#2 lands.

Review: Does the OCaml rewatch use any changed Luv API? Only FS_event,
Loop, Timer, Handle and Error (native_watcher.ml). The fork's API change
(statfs reserved fields read as zero) does not reach it.

Area: rewatch ci
Output: unchanged
Tests: none, because no observable behavior changes; the shared rewatch
 suite (113 checks, incl. watch mode), the rewatch-ocaml focused suite and
 scripts/test.js -ounit -build -mocha -docstrings pass on the new libuv
Measured: watch edit latency, median of 21 interleaved edits (basic
 fixture) 99 -> 100 ms, A/A control 98 ms; 400-directory fixture 98 -> 102
 ms, A/A control 100 ms; watch cold start, median of 7 (400 dirs) 213 ->
 211 ms, A/A 212 ms; idle watcher CPU over 20 s 70-90 ms for all; clean
 build (400 modules), median of 9, 180 -> 180 ms; linux-arm64 devcontainer
 under load, job tmp watch_ab.py and clean_ab.py
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Q6perkzKBQQebDnVXAEK
The Luv override now fetches 2094c025, the merge commit of
rescript-lang/luv#2 and the fork's master tip, instead of the PR head
8c12b1a. Both commits have the same tree (7acc6c6d), so the built sources
are identical.

Area: ci
Output: unchanged
Tests: none, because the fetched source tree is identical to the tested one
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Q6perkzKBQQebDnVXAEK
@cknitt
cknitt marked this pull request as ready for review October 17, 2026 07:40
@cknitt
cknitt requested a review from fhammerschmidt October 17, 2026 07:42
@pkg-pr-new

pkg-pr-new Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8883

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8883

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8883

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8883

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8883

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8883

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8883

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8883

commit: 2f6780b

The devcontainer's postCreate.sh and the CONTRIBUTING setup steps now add
.github/opam-repository as the rescript-overrides repository before
`opam install .`, as the CI setup action does. luv.0.5.14+rescript.1 exists
only there, so without it the solver finds no Luv; this used to go unnoticed
because luv.0.5.14 is also in the default repository.

Review: Is it safe when postCreate runs again? Adding an already registered
name and URL succeeds and changes nothing (checked with opam 2.5.0).

Area: ci docs
Output: unchanged
Tests: none, because the test-devcontainer CI job exercises postCreate.sh
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Q6perkzKBQQebDnVXAEK
@cknitt
cknitt enabled auto-merge (squash) October 18, 2026 06:19
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.04%. Comparing base (b3c4184) to head (2f6780b).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8883      +/-   ##
==========================================
+ Coverage   80.98%   81.04%   +0.05%     
==========================================
  Files         455      455              
  Lines       63390    63502     +112     
==========================================
+ Hits        51339    51463     +124     
+ Misses      12051    12039      -12     

see 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

rescript.opam (from rescript.opam.template) now pins luv.0.5.14+rescript.1
to the rescript-lang/luv commit via pin-depends, so `opam install .` fetches
it in CI, the devcontainer and local setups alike. The
.github/opam-repository overlay, its registration in the CI setup action,
in postCreate.sh and in CONTRIBUTING, and its cache-key entry are removed;
the cache key still changes with the pin through rescript.opam.

Review: Does --deps-only apply pin-depends? Yes: with no overlay
registered, `opam install . --deps-only --with-test` (opam 2.5.0) pinned
and installed luv.0.5.14+rescript.1 at 2094c025, with libuv 1.53.0.

Area: ci docs
Output: unchanged
Tests: none, because CI's opam setup and the test-devcontainer job
 exercise the pin
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9Q6perkzKBQQebDnVXAEK
@github-actions

Copy link
Copy Markdown

@cknitt
cknitt merged commit 70ffe6c into master Oct 18, 2026
30 checks passed
@github-actions

Copy link
Copy Markdown

@cknitt
cknitt deleted the luv-libuv-1.53 branch October 18, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants